home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / smixc130.zip / SMIX.H < prev    next >
C/C++ Source or Header  |  1997-06-06  |  7KB  |  143 lines

  1. /* ██ SMIX.H █████████████████████████████████████████████████████████████ */
  2.  
  3. #define TRUE  1
  4. #define FALSE 0
  5.  
  6. #define ON  1
  7. #define OFF 0
  8.  
  9. typedef struct
  10.   {
  11.     int xmshandle;
  12.     long startofs;
  13.     long soundsize;
  14.   } SOUND;
  15.  
  16. int  init_sb(int baseio, int irq, int dma, int dma16);
  17.   /* Initializes control parameters, resets DSP and installs int. handler   */
  18.   /*  Parameters:                                                           */
  19.   /*   baseio    Sound card base IO address                                 */
  20.   /*   irq       Sound card IRQ setting                                     */
  21.   /*   dma       Sound card 8-bit DMA channel                               */
  22.   /*   dma16     Sound card 16-bit DMA channel                              */
  23.   /*  Returns:                                                              */
  24.   /*   TRUE      Sound card successfully initialized                        */
  25.   /*   FALSE     Sound card could not be initialized                        */
  26.  
  27. void shutdown_sb(void);
  28.   /* Removes interrupt handler and resets DSP                               */
  29.  
  30.  
  31. void set_sampling_rate(unsigned short rate);
  32.   /* Overrides default sampling rate set with SAMPLING_RATE constant        */
  33.   /*  Parameters:                                                           */
  34.   /*   Rate:     New sampling rate (will be rounded by sound card)          */
  35.   /* This function can either be called before calling InitMixing (after    */
  36.   /* calling InitSB) to change the sampling rate before playback begins or  */
  37.   /* called during playback to change the rate dynamically.  The lowest     */
  38.   /* sampling rate that will work is roughly 5000 HZ.  The highest sampling */
  39.   /* rate that will work on all sound cards is 22050 HZ.  If you only want  */
  40.   /* to support the SB16, then you can use rates all the way up to 48000 HZ */
  41.  
  42.  
  43. void init_mixing(void);
  44.   /* Allocates internal buffers and starts digitized sound output           */
  45.  
  46. void shutdown_mixing(void);
  47.   /* Deallocates internal buffers and stops digitized sound output          */
  48.  
  49.  
  50. int  init_xms(void);
  51.   /* Initializes extended memory driver                                     */
  52.   /*  Returns:                                                              */
  53.   /*   TRUE      Extended memory driver successfully initialized            */
  54.   /*   FALSE     Extended memory driver could not be initialized            */
  55.  
  56. unsigned short getfreexms(void);
  57.   /* Returns amount of free extended memory (In kilobytes)                  */
  58.  
  59.  
  60. void init_sharing(void);
  61.   /* Allocates an EMB that all sound data will be stored in.  Using this    */
  62.   /* will preserve extended memory handles, which are scarce resources.     */
  63.   /* Call this on initialization and all sounds will automatically be       */
  64.   /* stored in one EMB.  You can call load_sound as usual to allocate a     */
  65.   /* sound, but free_sound will only deallocate the sound data structure.   */
  66.   /* You must call shutdown_sharing before program termination in order     */
  67.   /* to free all allocated extended memory.                                 */
  68.  
  69. void shutdown_sharing(void);
  70.   /* Shuts down EMB sharing and frees shared EMB block                      */
  71.  
  72.  
  73. int open_sound_resource_file(char *filename);
  74.   /* Opens a resource file for loading sounds.  After this has been called, */
  75.   /* the Key parameter in the LoadSound function is used as a resource key  */
  76.   /* to locate the sound data in this file.                                 */
  77.   /*  Parameters:                                                           */
  78.   /*   FileName: File name of resource file                                 */
  79.   /*  Returns:                                                              */
  80.   /*   TRUE      Sound resource file exists                                 */
  81.   /*   FALSE     Error, sound resource file does not exist                  */
  82.  
  83.  
  84. void close_sound_resource_file(void);
  85.   /* Close sound resource file.  If you have called this, the Key parameter */
  86.   /* to the LoadSound function will act as a filename instead of a resource */
  87.   /* key.                                                                   */
  88.  
  89.  
  90. int load_sound(SOUND **sound, char *key);
  91.   /* Allocates an memory buffer and loads a sound from a file               */
  92.   /*  Parameters:                                                           */
  93.   /*   sound     Pointer to pointer to unallocated sound data structure     */
  94.   /*   key       If a resource file has been opened then key is a resource  */
  95.   /*             identifier.  Use the same ID as you used when adding the   */
  96.   /*             sound resource with SNDLIB.  If a resource file is not     */
  97.   /*             opened, then key is the filename from which to load the    */
  98.   /*             sound data.                                                */
  99.   /*  Returns:                                                              */
  100.   /*   TRUE      Sound loaded successfully                                  */
  101.   /*   FALSE     Error loading sound                                        */
  102.  
  103. void free_sound(SOUND **sound);
  104.   /* Frees sound data structure and extended memory block                   */
  105.   /*  Parameters:                                                           */
  106.   /*   sound     Pointer to pointer to allocated sound data structure       */
  107.  
  108.  
  109. int start_sound(SOUND *sound, int index, int loop);
  110.   /* Starts playing a sound                                                 */
  111.   /*  Parameters:                                                           */
  112.   /*   sound     Pointer to sound data structure                            */
  113.   /*   index     A number to keep track of the sound with (Used to stop it) */
  114.   /*   loop      Indicates whether sound should be continuously looped      */
  115.   /*  Returns:                                                              */
  116.   /*   TRUE      Sound started successfully                                 */
  117.   /*   FALSE     Sound not started (no free channels)                       */
  118.  
  119. void stop_sound(int index);
  120.   /* Stops playing a sound                                                  */
  121.   /*  Parameters:                                                           */
  122.   /*   index     Index of sound to stop (All with given index are stopped)  */
  123.  
  124. int  sound_playing(int index);
  125.   /* Checks if a sound is still playing                                     */
  126.   /*  Parameters:                                                           */
  127.   /*   index     Index used when the sound was started                      */
  128.   /*  Returns:                                                              */
  129.   /*   TRUE      At least one sound with the specified index is playing     */
  130.   /*   FALSE     No sounds with the specified index are playing             */
  131.  
  132.  
  133.  
  134. extern volatile long  intcount;       /* Current count of sound interrupts  */
  135. extern volatile int   voicecount;     /* Number of voices currently in use  */
  136.  
  137. extern short dspversion;
  138. extern int   autoinit;
  139. extern int   sixteenbit;
  140.  
  141. /* ████████████████████████████████████████████████████████████████████████ */
  142.  
  143.